package com.ruoyi.client.controller;

import com.ruoyi.client.pojo.form.GoodsPageForm;
import com.ruoyi.client.pojo.vo.GoodsVo;
import com.ruoyi.client.service.IGoodsService;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author：HuaQP
 * @Date：2024/4/23
 */
@Anonymous  //接口允许匿名访问
@RestController
@RequestMapping("/goods")
public class GoodsController extends BaseController {
    @Resource
    private IGoodsService goodsService;

    @GetMapping("/page")
    public TableDataInfo page(GoodsPageForm form) {

        startPage();
        // 获取数据
        List<GoodsVo> list = goodsService.queryPage(form);
        // 接口返回
        return getDataTable(list);
    }
}
